package com.aaa.controller;


import com.aaa.entity.EduSubject;
import com.aaa.service.IEduCourseService;
import com.aaa.service.IEduSubjectService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zyd
 * @since 2021-03-24
 */
@RestController
@RequestMapping("/edu-subject")
public class EduSubjectController {
    @Resource
    private IEduSubjectService service;

    /**
     * 课程分类的查询事件
     * 带有模糊查询
     * @param
     * @param subject
     * @return
     */
    @PostMapping("/queryAll")
    public List<EduSubject> queryAll(EduSubject subject){
        return service.queryAll(subject);
    }

    /**
     * 课程类型的添加
     * 一级  和 二级  添加 是同一个 方发和路径
     * @param subject
     * @return
     */

    @PostMapping("/addSubject")
    public boolean addSubject(EduSubject subject){
        return service.save(subject);
    }

    /**
     * 根据后台  传入的数据   根据主键id修改信息
     * @param subject
     * @return
     */

    @PostMapping("/updSubject")
    public  boolean uodSubject(EduSubject subject){
        return service.updateById(subject);
    }

}

